#include"SList.h"
//手搓链表
void SList_test1()
{
    //申请节点
    SNode* n1 = (SNode*)malloc(sizeof(SNode));
    SNode* n2 = (SNode*)malloc(sizeof(SNode));
    SNode* n3 = (SNode*)malloc(sizeof(SNode));
    SNode* n4 = (SNode*)malloc(sizeof(SNode));
    //放入数据
    n1->val = 1;
    n2->val = 2;
    n3->val = 3;
    n4->val = 4; 
    //产生关系 链接
    n1->next = n2;
    n2->next = n3;
    n3->next = n4;
    n4->next = NULL;
    SListPrint(n1);

    //
    //SListPushBack(n1,9);
    SListPrint(n1);

}
void SList_test2()
{
    //这个n1就相当于是个哨兵位
    SNode* n1 = (SNode*)malloc(sizeof(SNode));
   // n1->val = 1;


    // SNode* plist = NULL;
    // SListPushBack(&plist,9);
    // SListPrint(plist);
    // SListPushFront(&plist,1);
    // SListPrint(plist);
    SNode* plist1 = NULL;
    SListPushFront(&plist1,8888);
    SListPushFront(&plist1,2);
    SListPushFront(&plist1,3888);
    SListPushFront(&plist1,4888);
    SListPrint(plist1);
     SListPopFront(&plist1);
    SListPrint(plist1);
     SListPopFront(&plist1);
     SListPopFront(&plist1);
     SListPopFront(&plist1);
    SListPrint(plist1);


    SListPushFront(&plist1,3888);
    SListPushFront(&plist1,4888);
    SListPrint(plist1);
    SListPopBack(&plist1);
    SListPrint(plist1);
      SListPopBack(&plist1);
      //SListPopBack(&plist1);
    SListPrint(plist1);

}
void  SList_test3()
{
    SNode* plist1 = NULL;
    SListPushFront(&plist1,1);
    SListPushFront(&plist1,2);
    SListPushFront(&plist1,3);
    SListPushFront(&plist1,4);
    SListPrint(plist1);
    SNode* pos = SListFind(plist1, 2);
    pos->val = 999999;
    SListPrint(plist1);
}
int main()
{
    SList_test3();
    return 0;
}